#include "inifile.h"
#include "common.h"
#include <QTextCodec>

CIniFile::CIniFile(QString strFile):m_pQSetting(0)
{
    CCommon::Instance()->SetIniFilePtr(this);

    m_stOcrCfg.nCardType = 0;
    m_pQSetting = new QSettings(strFile, QSettings::IniFormat);
    m_pQSetting->setIniCodec(QTextCodec::codecForName("Utf8"));
    m_stOcrCfg.nCardType = GetInt("Ocr", "Cardtype");
}

CIniFile::~CIniFile()
{

}

void CIniFile::SetStr(const QString strSection, const QString strKey, const QVariant value)
{
    m_pQSetting->setValue(strSection+strKey, value);
}

QString CIniFile::GetStr(QString strSection, QString strKey)
{
    return m_pQSetting->value(strSection+"/"+strKey).toString();
}

int CIniFile::GetInt(QString strSection, QString strKey)
{
    //return m_pQSetting->value(strSection+"/"+strKey).toInt();
    return m_pQSetting->value("Ocr/Cardtype", 2).toInt();
}


